#ifndef WF_DRAWARCTANGENTIAL_H
#define WF_DRAWARCTANGENTIAL_H

#include "pf_previewactioninterface.h"
#include "pf_arc.h"
#include "gui_export.h"

/**
 * This action class can handle user events to draw 
 * arcs with three points given.
 *
 */
class GUI_EXPORT WF_DrawArcTangential : public PF_PreviewActionInterface {
	Q_OBJECT
public:
    /**
     * Action States.
     */
    enum Status {
		SetBaseEntity,   /**< Setting base entity. */
		SetEndAngle      /**< Setting end angle. */
    };

public:
    WF_DrawArcTangential(PF_Container& container,
                       PF_GraphicView& graphicView);
    ~WF_DrawArcTangential();
	
	static QAction* createGUIAction(LX_Define::ActionType /*type*/, QObject* /*parent*/);
	
	virtual LX_Define::ActionType rtti() {
		return LX_Define::ActionDrawArcTangential;
	}

    void reset();

    virtual void init(int status=0);
	
    virtual void trigger();
	void preparePreview();
	
    virtual void mouseMoveEvent(PF_MouseEvent* e);
    virtual void mouseReleaseEvent(PF_MouseEvent* e);

	virtual void coordinateEvent(PF_CoordinateEvent* e);
    virtual void commandEvent(PF_CommandEvent* e);
	virtual PF_StringList getAvailableCommands();
    
	virtual void hideOptions();
    virtual void showOptions();
	
    virtual void updateMouseButtonHints();
    virtual void updateMouseCursor();
    virtual void updateToolBar();

	void setRadius(double r) {
		data.radius = r;
	}

	double getRadius() {
		return data.radius;
	}

protected:
    /**
     * Base entity.
     */
    PF_AtomicEntity* baseEntity;
	/**
	 * Start point of base entity clicked?
	 */
	bool isStartPoint;
    /**
     * Point that determines end angle.
     */
    PF_Vector point;
    /**
	 * Arc data calculated.
	 */
	PF_ArcAttribute data;
};

#endif
